<template>
	<div class="layout flex align-center">
		<div class="flex align-center" @click="navTo('/pages/cityList/cityList')">
			<text>{{currentAddress.label || '成都市'}}</text>
			<u-icon name="arrow-right" size="26"></u-icon>
		</div>
		<div class="search rounded-max-lg flex-1 ml-1 flex align-center justify-between" @click="handleSearch">
			<u-icon name="search"></u-icon>
			<text>精品零食抢购</text>
		</div>
	</div>
</template>
<script>
	import {
		mapGetters
	} from 'vuex'
	export default {
		title: "搜索栏",
		props: ["res", "storeId"],
		computed: {
			...mapGetters(['currentAddress'])
		},
		methods: {
			navTo(url) {
				uni.navigateTo({
					url
				})
			},
			handleSearch() {
				if (this.storeId) {
					uni.navigateTo({
						url: `/pages/navigation/search/searchPage?storeId=${this.storeId}`,
					});
				} else {
					uni.navigateTo({
						url: `/pages/navigation/search/searchPage`,
					});
				}

			},
		},
	};
</script>
<style lang="scss" scoped>
	@import "./tpl.scss";

	.search {
		height: 64rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		background: #ededed;
	}

	.layout {
		background: #fff;
		padding: 0 16rpx;
		position: relative;
	}

	.navbar-right {
		position: absolute;
		top: 0;
		// right: 0;
	}

	.searchbtn {
		height: 30px;
		right: 20rpx;
		top: 2rpx;
	}
</style>